 package com.nanuminc.market.today;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;


import com.nanuminc.market.R;

     	public class TodayLocationCity_ngoc extends Activity implements OnItemClickListener {
     	  
     	  private ListView mLv_CityList ;
     	  private ArrayAdapter<String> listAdapter ;
     	  
     	  /** Called when the activity is first created. */
     	  @Override
     	  public void onCreate(Bundle savedInstanceState) {
     	    super.onCreate(savedInstanceState);
    		requestWindowFeature(Window.FEATURE_NO_TITLE); // Q
     	    setContentView(R.layout.location_city_ngoc); // View 내용 Activity에 박기

     	    // Find the ListView resource. 
         	mLv_CityList = (ListView) findViewById(R.id.lv_CityList);

     	    String[] loc = getResources().getStringArray(R.array.loc_all_info_ngoc);  //without this, the content can not be viewed on screen
     	    listAdapter = new ArrayAdapter<String>(TodayLocationCity_ngoc.this, R.layout.simplerow, loc);
      	   	mLv_CityList.setAdapter( listAdapter );      
      	   	
      	   	mLv_CityList.setOnItemClickListener(new OnItemClickListener() { 
      	          public void onItemClick(AdapterView<?> parent, View view, 
      	              int position, long id) { 
      	        	  Intent i = new Intent(getApplicationContext(), TodayLocationDistric_ngoc.class);
      	        	  String cityName = ((TextView) view).getText().toString();
      	        	  i.putExtra("city_name", cityName);
      	        	  i.putExtra("city_position", position);
      	        	  startActivity(i);
      	        	  //	Toast.makeText(parent.getContext(), "hello" + position, Toast.LENGTH_LONG).show();    	  
      	          	  } 
      	        });
      	   
     	  }
		@Override
		public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
				long arg3) {
			// TODO Auto-generated method stub
			
		}
     	}